import { logsByPage } from '@/api/logs';
import { PageContainer } from '@ant-design/pro-components';
import { Table } from 'antd';
import { useEffect, useState } from 'react';

export default () => {
  const [data, setData] = useState([]);

  const columns = [
    {
      title: '操作时间',
      dataIndex: 'startTime',
      key: 'startTime',
      width: 200,
    },
    {
      title: 'ip',
      dataIndex: 'userIp',
      key: 'userIp',
      width: 150,
    },
    {
      title: '操作人',
      dataIndex: 'userName',
      key: 'userName',
      width: 150,
    },
    {
      title: '操作内容',
      dataIndex: 'name',
      key: 'name',
      dataType: 'name',
      render: (_, record) => `${record.moduleName} - ${_}`,
    },
  ];

  const init = async () => {
    const resp = await logsByPage({
      pageNo: 1,
      pageSize: 100,
    });
    console.log('😈resps', resp);
    setData(resp?.data?.list || []);
  };

  useEffect(() => {
    init();
  }, []);

  return (
    <PageContainer>
      {/* <Card>
        <Row gutter={10}>
          <Col span={6}>
            <Input placeholder="请输入人员名称"></Input>
          </Col>
        </Row>
        <div className="flex-bt mt10">
          <div></div>
          <Button type="primary">搜索</Button>
        </div>
      </Card> */}
      <Table columns={columns} dataSource={data}></Table>
    </PageContainer>
  );
};
